<template>
  <div class="dx-stytem-container">
    <div class="dx-header-container">
      <div>用户</div>
      <div><i class="el-icon-close" @click="closeContainer" /></div>
    </div>
    <div v-if="componentName" class="dx-body-container">
      <component :is="componentName" :datailData="datailData"/>
    </div>
    <div
      v-else
      style="width: 100%; height: 200px; text-align: center; line-height: 200px"
    >
      暂无数据
    </div>
  </div>
</template>

<script>
import DataOptions from "./dataOptions";
export default {
  name: "DataDetail",
  inject: ["upDataDetailId"],
  props: {
    detailID: {
      type: String,
      default: () => "",
    },
    detailType: {
      type: String,
      default: () => "form",
    },
    datailData: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      detailData: {},
      detailMuenType: "",
      detailMuenID: "",
      componentName: "",
    };
  },
  mounted() {
    this.detailMuenType = this.$route.query.type || {};
    this.detailData = DataOptions.fieldlabel[this.detailMuenType];
    this.componentName =
      this.detailType === "form"
        ? this.detailData.components.form
        : this.detailData.components.detial;
  },
  methods: {
    closeContainer() {
      this.upDataDetailId({
        id: null,
        type: null,
      });
      // this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.dx-header-container {
  color: #fff;
}
.dx-stytem-container {
  width: 60vw;
  height: 70vh;
  position: fixed;
  padding: 0 15px;
  top: 10vh;
  left: 28vw;
  min-height: 480px !important;
  border-radius: 6px;
  border: 1px solid #299dc8;
  background-color: rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
  box-shadow: 0 0 6px #00b2ee, 0 0 2px #009acd inset;
  background-image: url("../../assets/homeImg/cc.png");
  background-size: 100% 100%;
  box-sizing: border-box;
  box-shadow: 0 0 6px #00b2ee, 0 0 2px #009acd inset;
  .dx-body-container {
    width: 100%;
    height: 100%;
  }
}
</style>
